<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>后台信息管理系统</title>
    <link th:href="@{../../css/bootstrap.min.css}" rel="stylesheet" />
    <link th:href="@{../../font-awesome/css/font-awesome.css}" rel="stylesheet" />

    <!-- Toastr style -->
    <link th:href="@{../../css/plugins/toastr/toastr.min.css}" rel="stylesheet"/>

    <link th:href="@{../../css/styleManage.css}" rel="stylesheet" />

    <!-- summernote style -->
    <link th:href="@{../../css/plugins/summernote/summernote.css}" rel="stylesheet" />
    <link th:href="@{../../css/plugins/summernote/summernote-bs3.css}" rel="stylesheet" />
</head>
<body>

<div id="wrapper">
    <nav class="navbar-default navbar-static-side" role="navigation" th:include="/manage/nav :: navigation"></nav>
    <div id="page-wrapper" class="gray-bg">
        <div class="border-bottom" th:include="/manage/header :: headerTop"></div>
        <div class="row wrapper border-bottom white-bg page-heading" th:fragment="headerNav">
            <div class="col-lg-10">
                <h2>订单管理</h2>
                <ol class="breadcrumb">
                    <li>
                        <a th:href="@{/manage/orderControl}">首页</a>
                    </li>
                    <li>
                        <a th:href="@{/manage/orderControl}">订单管理</a>
                    </li>
                    <li class="active">
                        <strong>订单修改</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">
            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>订单详情</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <form id="formTag" th:action="@{/manage/comfirm}" th:object="${order}" method="POST" class="form-horizontal" enctype="multipart/form-data">
                                <div class="form-group"><label class="col-sm-2 control-label">orderId:</label>
                                    <div class="col-sm-10">
                                        <input id="orderId" readonly="readonly" name="orderId" type="text" class="form-control" th:value="${session.order.orderId}"/>
                                    </div>
                                </div>
<!--                                <div class="form-group"><label class="col-sm-2 control-label">orderDate:</label>-->
<!--                                    <div class="col-sm-10">-->
<!--                                        <input id="orderDate" readonly="readonly" name="orderDate" type="text" class="form-control" th:value="${#dates.format(session.order.orderDate, 'yyyy-MM-dd HH:mm')}"/>-->
<!--                                    </div>-->
<!--                                </div>-->

                                <div class="hr-line-dashed"></div>
                                <div class="form-group"><label class="col-sm-2 control-label">Payment Details</label>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group"><label class="col-sm-2 control-label">Card Type:</label>
                                    <div class="col-sm-10">
                                        <input id="cardType" name="cardType" type="text" class="form-control" th:value="${session.order.cardType}"/>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Card Number:</label>
                                    <div class="col-sm-10">
                                        <input id="creditCard" name="creditCard" type="text" class="form-control" th:value="${session.order.creditCard}"/>* Fake
                                        number
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Expiry Date (MM/YYYY):</label>
                                    <div class="col-sm-10">
                                        <input id="expiryDate" name="expiryDate" type="text" class="form-control" th:value="${session.order.expiryDate}"/>
                                    </div>
                                </div>

                                <div class="hr-line-dashed"></div>
                                <div class="form-group"><label class="col-sm-2 control-label">Billing Address</label>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group"><label class="col-sm-2 control-label">First name:</label>
                                    <div class="col-sm-10">
                                        <input id="billToFirstName" name="billToFirstName" type="text" class="form-control" th:value="${session.order.billToFirstName}"/>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Last name:</label>
                                    <div class="col-sm-10">
                                        <input id="billToLastName" name="billToLastName" type="text" class="form-control" th:value="${session.order.billToLastName}"/>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Address 1:</label>
                                    <div class="col-sm-10">
                                        <input id="billAddress1" name="billAddress1" type="text" class="form-control" th:value="${session.order.billAddress1}"/>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Address 2:</label>
                                    <div class="col-sm-10">
                                        <input id="billAddress2" name="billAddress2" type="text" class="form-control" th:value="${session.order.billAddress2}"/>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">City:</label>
                                    <div class="col-sm-10">
                                        <input id="billCity" name="billCity" type="text" class="form-control" th:value="${session.order.billCity}"/>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">State:</label>
                                    <div class="col-sm-10">
                                        <input id="billState" name="billState" type="text" class="form-control" th:value="${session.order.billState}"/>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Zip:</label>
                                    <div class="col-sm-10">
                                        <input id="billZip" name="billZip" type="text" class="form-control" th:value="${session.order.billZip}"/>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Country:</label>
                                    <div class="col-sm-10">
                                        <input id="billCountry" name="billCountry" type="text" class="form-control" th:value="${session.order.billCountry}"/>
                                    </div>
                                </div>

                                <div class="hr-line-dashed"></div>
                                <div class="form-group"><label class="col-sm-2 control-label">Shipping Address</label>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group"><label class="col-sm-2 control-label">First name:</label>
                                    <div class="col-sm-10">
                                        <input id="shipToFirstName" name="shipToFirstName" type="text" class="form-control" th:value="${session.order.shipToFirstName}" />
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Last name:</label>
                                    <div class="col-sm-10">
                                        <input id="shipToLastName" name="shipToLastName" type="text" class="form-control" th:value="${session.order.shipToLastName}" />
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Address 1:</label>
                                    <div class="col-sm-10">
                                        <input id="shipAddress1" name="shipAddress1" type="text" class="form-control" th:value="${session.order.shipAddress1}" />
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Address 2:</label>
                                    <div class="col-sm-10">
                                        <input id="shipAddress2" name="shipAddress2" type="text" class="form-control" th:value="${session.order.shipAddress2}" />
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">City:</label>
                                    <div class="col-sm-10">
                                        <input id="shipCity" name="shipCity" type="text" class="form-control" th:value="${session.order.shipCity}" />
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">State:</label>
                                    <div class="col-sm-10">
                                        <input id="shipState" name="shipState" type="text" class="form-control" th:value="${session.order.shipState}" />
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Zip:</label>
                                    <div class="col-sm-10">
                                        <input id="shipZip" name="shipZip" type="text" class="form-control" th:value="${session.order.shipZip}" />
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Country:</label>
                                    <div class="col-sm-10">
                                        <input id="shipCountry" name="shipCountry" type="text" class="form-control" th:value="${session.order.shipCountry}" />
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Courier:</label>
                                    <div class="col-sm-10">
                                        <input id="courier" name="courier" type="text" class="form-control" th:value="${session.order.courier}" />
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">Status:</label>
                                    <div class="col-sm-10">
                                        <input id="status" name="status" type="text" class="form-control" th:value="${session.order.status}" />
                                    </div>
                                </div>

                                <div class="ibox-content">
                                    <div class="table-responsive">
                                        <table class=" table table-hover" data-page-size="10">
                                            <thead>
                                            <tr>
                                                <th>Item ID</th>
                                                <th>Description</th>
                                                <th>Quantity</th>
                                                <th>Price</th>
                                                <th>Total Cost</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <section th:each="lineItem:${session.order.lineItems}" name = "lineItems" th:value="${session.order.lineItems}">
                                            <tr>
                                                    <td>
                                                        <a th:href="@{/catalog/viewItem(itemId=${lineItem.item.itemId})}" th:text="${lineItem.item.itemId}">itemId</a>
                                                    </td>
                                                    <td>
                                                        <p th:if ="${lineItem.item} ne null">
                                                        <p th:text="${lineItem.item.attribute1}"></p>
                                                        <!--                                    ${lineItem.item.attribute1}-->
                                                        <!--                                    ${lineItem.item.attribute2}-->
                                                        <!--                                    ${lineItem.item.attribute3}-->
                                                        <!--                                    ${lineItem.item.attribute4}-->
                                                        <!--                                    ${lineItem.item.attribute5}-->
                                                        <!--                                    ${lineItem.item.product.name}-->
                                                        </p>
                                                        <p th:if ="${lineItem.item} eq null">
                                                            <!--                                <tr test="${lineItem.item == null}">-->
                                                            <i >{description unavailable}</i>
                                                        </p>
                                                    </td>

                                                    <td th:text="${lineItem.quantity}" ></td>
                        <!--                            <td th:text="${lineItem.quantity}" >quantity</td>-->

                                                    <td th:text="'$'+${#numbers.formatDecimal(lineItem.unitPrice,1,'COMMA',2,'POINT')}">money</td>
                                                    <!--                            <fmt:formatNumber value="${lineItem.unitPrice}"-->
                                                    <!--                                                  pattern="$#,##0.00" />-->

                                                    <td th:text="'$'+${#numbers.formatDecimal(lineItem.total,1,'COMMA',2,'POINT')}">money</td>
                                                    <!--                            <td><fmt:formatNumber value="${lineItem.total}"-->
                                                    <!--                                                  pattern="$#,##0.00" /></td>-->
                                                </tr>
                                            </section>
                                            </tbody>
                                            <tfoot>
                                            <tr>
                                                <td colspan="9">
                                                    <ul id="pageHTML" class="pagination pull-right"></ul>
                                                </td>
                                            </tr>
                                            </tfoot>
                                        </table>

                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group"><label class="col-sm-2 control-label">Total:</label>
                                                <div class="col-sm-10">
                                                    <input readonly="readonly" name="totalPrice" id="totalPrice" type="text" class="form-control" th:value="${session.order.totalPrice}">
                                                </div>
                                            </div>


                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-2">
                                                <button id="finish" class="btn btn-primary">&nbsp;&nbsp;&nbsp;&nbsp;提&nbsp;&nbsp;&nbsp;&nbsp;交&nbsp;&nbsp;&nbsp;&nbsp;</button>
                                                <button class="btn btn-primary"><a th:href="@{/manage/orderControl}" id="return" >RETURN</a></button>
                                            </div>
                                        </div>
                                        <p>
                                            <font color="#FF6984" th:text="${msg}">${requestScope.msg}</font>
                                        </p>
                                    </div>
                                </div>

    </form>
</div>
                    </div>
                </div>
            </div>
        </div>
                        <div class="footer" th:include="/manage/footer :: copyright"></div>
    </div>
</div>
<!-- Mainly scripts -->
<script th:src="@{../../js/jquery-2.1.1.js}"></script>
<script th:src="@{../../js/bootstrap.min.js}"></script>
<script th:src="@{../../js/plugins/metisMenu/jquery.metisMenu.js}"></script>
<script th:src="@{../../js/plugins/slimscroll/jquery.slimscroll.min.js}"></script>

<!-- Peity -->
<script th:src="@{../../js/plugins/peity/jquery.peity.min.js}"></script>

<!-- Custom and plugin javascript -->
<script th:src="@{../../js/inspinia.js}"></script>
<script th:src="@{../../js/plugins/pace/pace.min.js}"></script>

<!-- Toastr script -->
<script th:src="@{../../js/plugins/toastr/toastr.min.js}"></script>

<!-- common -->
<script th:src="@{../../js/common.js}"></script>

<!-- SUMMERNOTE -->
<script th:src="@{../../js/plugins/summernote/summernote.min.js}"></script>


<script th:inline="javascript">
    var image = [[${item.image}]];
    $(document).ready(function () {
        if(image==null || image==""){
            $("#imageCell").hide();
            $("#imputCell").show();
        } else {
            $("#imageCell").show();
            $("#imputCell").hide();
        }
        $("#imageCellBut").click(function(){
            $("#imageCell").hide();
            $("#imputCell").show();
        });
    });
</script>
<script th:inline="javascript">
    $(document).ready(function () {
        //初始化编辑器
        $('#summernote').summernote({
            height: 300,
            codemirror: {
                mode: 'text/html',
                htmlMode: true,
                lineNumbers: true,
                theme: 'monokai'
            }
        });
        //编辑器赋值

        //提交
        $("#submitButton").click(function(){
            if($("#title").val() == ""){
                toastr.error('请输入商品标题','提示');
                return;
            }
            if($("#category").val() == 0){
                toastr.error('请选择商品分类','提示');
                return;
            }
            if($("#price").val() == 0){
                toastr.error('请输入商品价格','提示');
                return;
            }
            if($("#num").val() == 0){
                toastr.error('请输入库存数量','提示');
                return;
            }
            $("#formTag").submit();
        });
    });
</script>

</body>
</html>